<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="">投诉列表</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="get" action="{:url('admin/message/index')}">
        管理员：
        <select name="admin_id" id="" class="form-control">
            <volist name="$admin_all" id="vo">
                <eq name="$admin_id" value="$vo['id']">
                    <option selected value="{$vo.id}">{$vo.user_nickname}</option>
                    <else/>
                    <option value="{$vo.id}">{$vo.user_nickname}</option>
                </eq>

            </volist>
        </select>
        处理状态：
        <select name="msg_type" id="" class="form-control">
            <option value="">全部</option>
            <volist name="$mag_type" id="vo">
                <eq name="$msg_type" value="$vo.val">
                    <option value="{$vo.val}" selected>{$vo.name}</option>
                    <else/>
                    <option value="{$vo.val}">{$vo.name}</option>
                </eq>

            </volist>

        </select>
        <input type="submit" class="btn btn-primary" value="搜索"/>

    </form>
    <table class="table table-hover table-bordered">
        <thead>
        <tr>
            <th>编号</th>
            <th>卡号</th>
            <th>类型</th>
            <th>联系方式</th>
            <th>备注</th>
            <th>投诉时间</th>
            <th>回复</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <volist name="$mas_list" id="vo">
            <tr>
                <td>{$vo.msg_id}</td>
                <td>{$vo.cod_id}</td>
                <td>{$vo.type}</td>
                <td>{$vo.phone}</td>
                <td>{$vo.else}</td>
                <td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
                <td>{$vo.result}
                    <a href="javascript:;" class="addVal" data-id="{$vo.msg_id}" data-val="{$vo.result}">
                        <if empty($vo[
                        'result'])>
                        添加回复
                        <else/>
                        修改回复
                        </if>
                    </a>
                </td>
                <td>{:getMsgType($vo['state'])['name']}</td>
                <td width="10%">
                    <lt name="$vo['state']" value="3">
                        <a href="{:cmf_url('admin/message/up',['msg_id'=>$vo['msg_id'],'state'=>$vo['state']])}"
                           class="js-ajax-delete" data-msg="确定要下一步">进入下一步</a>
                    </lt>
                </td>
            </tr>
        </volist>

        </tbody>
        </tbody>
    </table>
    <ul class="pagination">
        {$mas_list->render()}
    </ul>
</div>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>
<script src="__STATIC__/js/layer/layer.js"></script>

<script>
    $(function () {
        $('.addVal').click(function () {
            var $this = $(this);
            layer.prompt({
                title: '请输入内容',
                formType: 2,
                value: $this.data('val')
            }, function (val, index) {
                $.post("{:cmf_url('admin/message/up')}", {msg_id: $this.data('id'), result: val}, function (da) {
                    if (da.code) {
                        layer.closeAll();
                        layer.msg(da.msg,{
                            end:function () {
                                location.reload();
                            }
                        })
                    }
                    else {
                        layer.alert(da.msg);
                    }
                    // console.log(da);
                })
            })
        });

    })
</script>